package com.power.sifa.approve.model.enumeration;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * @ClassName Tp_decisionEnum
 * @Author xiongzw
 * @Date 2023/9/20 18:41
 * @Description
 * @Version: 1.0
 **/

@Getter
public enum Tp_decisionEnum {


    /**
     * 驳回复议申请
     */
    PROREJECT("proreject", 6004800, "驳回复议申请", "驳回复议申请", Tp_proctype.HEAR_DECISION, Arrays.asList(Tp_procmaterialEnum.HEAR_REJECT)),

    /**
     * 驳回复议请求
     */
    SUBREJECT("subreject", 6004801, "驳回复议请求", "驳回复议请求", Tp_proctype.HEAR_DECISION, Arrays.asList(Tp_procmaterialEnum.HEAR_REJECT)),
    /**
     * 维持
     */
    MAINTAIN("maintain", 6004802, "维持", "维持", Tp_proctype.HEAR_DECISION, Arrays.asList(Tp_procmaterialEnum.HEAR_DECISION)),
    /**
     * 确认违法
     */
    BREAKLAW("breaklaw", 6004803, "确认违法", "确认违法", Tp_proctype.HEAR_DECISION, Arrays.asList(Tp_procmaterialEnum.HEAR_DECISION)),

    /**
     * 变更
     */
    CHANGE("change", 6004804, "变更", "变更", Tp_proctype.HEAR_DECISION, Arrays.asList(Tp_procmaterialEnum.HEAR_DECISION)),

    /**
     * 责令履行
     */
    ORDER("order", 6004805, "责令履行", "责令履行", Tp_proctype.HEAR_DECISION, Arrays.asList(Tp_procmaterialEnum.HEAR_DECISION)),

    /**
     * 其它
     */
    // OTHER("other", 6004806, "其它", "其它", Tp_proctype.HEAR_DECISION, Arrays.asList(Tp_procmaterialEnum.HEAR_DECISION)),

    /**
     * 撤销调整文件， 由之前的撤回行政复议申请书调整为行政复议决定书
     */
    REVOKE("revoke", 6004807, "撤销", "撤销", Tp_proctype.HEAR_WITHDRAW, Arrays.asList(Tp_procmaterialEnum.HEAR_DECISION)),

    /**
     * 终止-调解
     */
    TERMEDIATE("termediate", 6004808, "终止-调解", "终止-调解", Tp_proctype.HEAR_MEDIATE, Arrays.asList(Tp_procmaterialEnum.HEAR_MEDIATE,
            Tp_procmaterialEnum.HEAR_RECONCILIATE)),

    /**
     * 终止-其它
     */
    TEROTHER("terother", 6004809, "终止-其它", "终止-其它", Tp_proctype.HEAR_DECISION,
            Arrays.asList(Tp_procmaterialEnum.HEAR_TERMIN)),

    /**
     * 确认行政行为无效
     */
    INVALID("invalid", 6004810, "确认行政行为无效", "确认行政行为无效", Tp_proctype.HEAR_DECISION, Collections.emptyList()),

    /**
     * 决定依法给予合理补偿
     */
    COMPENSATION("compensation", 6004811, "决定依法给予合理补偿", "决定依法给予合理补偿", Tp_proctype.HEAR_DECISION, Collections.emptyList()),

    /**
     * 决定依法给予赔偿
     */
    LAWPAY("lawpay", 6004812, "决定依法给予赔偿", "决定依法给予赔偿", Tp_proctype.HEAR_DECISION, Collections.emptyList()),


    /**
     * 决定依法给予赔偿
     */
    RESPONSIBILITY("responsibility", 6004813, "责令履行责任", "责令履行责任", Tp_proctype.HEAR_DECISION, Collections.emptyList()),

    /**
     * 驳回行政赔偿请求
     */
    REJECTPAY("rejectpay", 6004814, "驳回行政赔偿请求", "驳回行政赔偿请求", Tp_proctype.HEAR_DECISION, Collections.emptyList());


    private String key;

    private Integer id;

    private String name;

    private String description;

    private Integer proctype;

    // 需要校验的材料
    private List<Tp_procmaterialEnum> materilas;

    Tp_decisionEnum(String key, Integer id, String name, String description, Integer proctype,
                    List<Tp_procmaterialEnum> materilas) {
        this.key = key;
        this.id = id;
        this.name = name;
        this.description = description;
        this.proctype = proctype;
        this.materilas = materilas;
    }

    public static Tp_decisionEnum getByKey(String key) {
        Tp_decisionEnum[] decisionEnums = Tp_decisionEnum.values();
        for (Tp_decisionEnum decisionEnum : decisionEnums) {
            if (StringUtils.isNotEmpty(decisionEnum.key) && decisionEnum.key.equals(key)) {
                return decisionEnum;
            }
        }
        return null;
    }

    public static Tp_decisionEnum getById(Integer id) {
        Tp_decisionEnum[] decisionEnums = Tp_decisionEnum.values();
        for (Tp_decisionEnum decisionEnum : decisionEnums) {
            if (decisionEnum.id.equals(id)) {
                return decisionEnum;
            }
        }
        return null;
    }
}
